﻿using Microsoft.Extensions.Options;
using System.Collections.Generic;
using Volo.Abp.DependencyInjection;
using Xms.Abp.Caching;

namespace SettingsManagement;

public class SettingsCacheContext : CacheContext<SettingsCacheContext>, ISettingsCacheContext, ITransientDependency
{
    public SettingsCacheContext(
        IAbpLazyServiceProvider lazyServiceProvider,
        IOptions<DistributedCacheProviderOptions> optionsAccessor,
        IEnumerable<ICacheProvider<SettingsCacheContext>> cacheProviders)
        : base(
            lazyServiceProvider,
            optionsAccessor,
            cacheProviders)
    {
    }

    public IHashCache<string> GetSettings(string key) => Hash(key);

    public IHashCache<int> GetEnumSettings(string key) => Hash<int>(key);
}
